# +----------------------------------------------------------------------
# | zhanshop-app / sign_auth.py    [ 2024/4/18 18:06 ]
# +----------------------------------------------------------------------
# | Copyright (c) 2011~2024 zhangqiquan All rights reserved.
# +----------------------------------------------------------------------
# | Author: Administrator <768617998@qq.com>
# +----------------------------------------------------------------------
from functools import wraps

from flask import request


def sign_auth_middleware(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        print(request.path)
        print(request.method)
        print(request.get_data())
        #$appName = $request->header('app-name', "");
        # 中间件逻辑：请求前处理
        print("Middleware: Before route execution")

        # 执行原视图函数
        response = func(*args, **kwargs)

        # 中间件逻辑：请求后处理
        print("Middleware: After route execution")
        return response

    return wrapper